package com.wxq.ware.service.impl;

import com.wxq.ware.entity.PurchaseEntity;
import org.springframework.stereotype.Component;
import top.javatool.canal.client.annotation.CanalTable;
import top.javatool.canal.client.handler.EntryHandler;

/**
 * @author Jim
 * @date 11:51 下午 2022/4/18
 * @description
 * @email:huwmz04153277@126.com
 */
@CanalTable("wms_purchase")
@Component
public class UserHandler implements EntryHandler<PurchaseEntity> {
    @Override
    public void insert(PurchaseEntity item) {
        System.out.println("insert," + item);
        // 写数据到JVM进程缓存
        //itemCache.put(item.getId(), item);
        // 写数据到redis
        //redisHandler.saveItem(item);
    }

    @Override
    public void update(PurchaseEntity before, PurchaseEntity after) {
        System.out.println("update before," + before);
        System.out.println("update after," + after);
        // 写数据到JVM进程缓存
        //itemCache.put(after.getId(), after);
        // 写数据到redis
        //redisHandler.saveItem(after);
    }

    @Override
    public void delete(PurchaseEntity item) {
        System.out.println("delete," + item);
        // 删除数据到JVM进程缓存
        //itemCache.invalidate(item.getId());
        // 删除数据到redis
        //redisHandler.deleteItemById(item.getId());
    }
}
